﻿@page

@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPost
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Blogs.BlogPostComment
@using Volo.CmsKit.Public.Web.Pages
@using Volo.Abp.GlobalFeatures
@using Volo.CmsKit.GlobalFeatures
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.ReactionSelection
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Tags

@inherits CmsKitPublicPageBase

@model Volo.CmsKit.Public.Web.Pages.Public.CmsKit.Blogs.BlogPostModel

@await Component.InvokeAsync(typeof(DefaultBlogPostViewComponent), new
{
    Model.BlogSlug,
    Model.BlogPostSlug
})

@if (GlobalFeatureManager.Instance.IsEnabled<TagsFeature>())
{
    if (Model.TagsFeature?.IsEnabled == true)
    {
        @await Component.InvokeAsync(typeof(TagViewComponent), new
        {
            entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType,
            entityId = Model.BlogPost.Id.ToString()
        })
    }
}

@if (GlobalFeatureManager.Instance.IsEnabled<ReactionsFeature>())
{
    if (Model.ReactionsFeature?.IsEnabled == true)
    {
        @await Component.InvokeAsync(typeof(ReactionSelectionViewComponent), new
        {
            entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType,
            entityId = Model.BlogPost.Id.ToString()
        })
    }
}

@if (GlobalFeatureManager.Instance.IsEnabled<RatingsFeature>())
{
    if (Model.RatingsFeature?.IsEnabled == true)
    {
        @await Component.InvokeAsync(typeof(RatingViewComponent), new
        {
            entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType,
            entityId = Model.BlogPost.Id.ToString()
        })
    }
}

<hr />

@if (GlobalFeatureManager.Instance.IsEnabled<CommentsFeature>())
{
    if (Model.CommentsFeature?.IsEnabled == true)
    {
        @await Component.InvokeAsync(typeof(DefaultBlogPostCommentViewComponent), new
        {
            entityType = Volo.CmsKit.Blogs.BlogPostConsts.EntityType,
            entityId = Model.BlogPost.Id.ToString()
        })
    }
}